﻿package ascript.components.animation
{
	//#########################
	// Header Includes
	//#########################
	import ascript.Game;
	import ascript.GameComponent;
	import ascript.GameLevel;
	import ascript.GameObject;
	
	//#########################
	// GeneralModifiers Class
	//#########################
	public class AnimationCharacterIdle extends AnimationCharacter
	{
		//=========================
		// Constructors
		//=========================	
		public function AnimationCharacterIdle():void
		{
		}
		
		//=========================
		// Members
		//=========================		
		override public function updateComponent( tGame:Game, tObject:GameObject, tLevel:GameLevel ):void
		{
			if ( tObject.getAttribute( "AnimationCharacterIsEnabled" ) )
			{
				// Inheritance
				super.updateComponent( tGame, tObject, tLevel );
				
				// Set Idle (+3 frames per direction)
				if ( tObject.getAttribute( "Direction" ).x == 0 && tObject.getAttribute( "Direction" ).y == 0 && tObject.getAttribute( "AnimationIndex" ) < 3 )
				{
					tObject.setAttribute( "AnimationIndex", ( tObject.getAttribute( "AnimationIndex" ) + 3 ) );
				}
			}
		}
	}
}